<?php

namespace App\Store\Models\Goods;

use App\Common\Services\Common;
use App\Store\Models\Basic\GoodsCategory;
use App\Store\Models\Basic\GoodsCraft;
use App\Store\Models\Basic\GoodsPricetype;
use App\Store\Models\Basic\GoodsStone;
use App\Store\Models\Basic\GoodsStyle;
use App\Store\Models\Basic\PaytypeList;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use App\Common\Services\Store\Common as StoreCommon;
use App\Store\Models\Account\SiteStore;
use App\Store\Models\Basic\GoodsBrand;
use App\Store\Models\Basic\Supply;

class GoodsStockinPrint extends Model
{
    protected $table = 'site_goods_stockin_print';
    public $timestamps = false;
    protected $primaryKey = 'id';
    protected $guarded = ['_token'];


    /**
     * 类别
     */
    public function goods_category()
    {
        return $this->hasOne(GoodsCategory::class, 'id', 'goods_category_id')->select('id', 'category_name','is_gram');
    }

    /**
     * 款式
     */
    public function goods_style()
    {
        return $this->hasOne(GoodsStyle::class, 'id', 'goods_style_id')->select('id', 'style_name');
    }

    /**
     * 店铺
     */
    public function storeinfo()
    {
        return $this->hasOne(SiteStore::class, 'id', 'store_id')->select('id', 'store_name','store_file_path','tracing_url','qrcode_url','brand_url');
    }

    /**
     * 供应商
     */
    public function supply()
    {
        return $this->hasOne(Supply::class, 'id', 'supply_id')->select('id', 'supply_name');
    }

    public function goods_craft()
    {
        return $this->hasOne(GoodsCraft::class, 'id', 'goods_craft_id')->select('id', 'craft_name');
    }
    public function goods_pricetype()
    {
        return $this->hasOne(GoodsPricetype::class, 'id', 'goods_pricetype_id')->select('id', 'pricetype_name');
    }
    public function goods_stone()
    {
        return $this->hasOne(GoodsStone::class, 'id', 'goods_stone_id')->select('id', 'stone_name');
    }
    public function paytype_info()
    {
        return $this->hasOne(PaytypeList::class, 'id', 'goods_stone_id')->select('id', 'paytype_name');
    }

    /**
     * 品牌
     */
    public function goods_brand()
    {
        return $this->hasOne(GoodsBrand::class, 'id', 'goods_brand_id')->select('id', 'brand_name');
    }


}
